package com.ymatou.payment.testcase;


import java.math.BigDecimal;
import java.security.PrivateKey;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.payment.parameter.CMBNotifyBean;
import com.ymatou.payment.serivce.NotifyCall;
import com.ymatou.payment.serivce.NotifyCall50;
import com.ymatou.paymentproxy.parameter.AcquireOrderBean;
import com.ymatou.paymentproxy.parameter.AliPayNotifyBean;
import com.ymatou.paymentproxy.parameter.AliPayWapNotifyBean;
import com.ymatou.paymentproxy.parameter.PayOrderEnum;
import com.ymatou.paymentproxy.parameter.WeiXinNotifyBean;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.core.tool.RSAUtils;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P2;
import com.ymt.utils.tag.P3;
import com.ymttest.business.data.Sign;
import com.ymttest.business.service.PaymentProxyCallService;
import com.ymttest.common.enums.BankIdEnum;
import com.ymttest.database.model.PPBussinessOrder;
import com.ymttest.database.model.PPCompensateProcessInfo;
import com.ymttest.database.model.PPPayment;
import com.ymttest.database.model.YmtAccountEntry;
import com.ymttest.database.sqlwapper.AccountDefaultWapper;
import com.ymttest.database.sqlwapper.DefaultWapper;
import com.ymttest.database.sqlwapper.PaymentDefaultWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;

/**
 * 支付异步回调接口 FreeMaker Template自动生成代码 回调主要验证微信JSAPI APP 支付宝PC APP场景 验证签名 返回码 支付号
 * 金额 商户号 异常情况
 * 验证不同渠道PayRecharge,PostPay,Recharge,SellerMarginRecharge,SellerRecharge资金流水
 */
@TestSuite
public class Ts_Notify {
	private static WeiXinNotifyBean wxnotifyBean;
	private static AliPayNotifyBean alinotifyBean;
	private static NotifyCall notifyCall;
	private static NotifyCall notifyCall50;
	private static CMBNotifyBean cmbNotifyBean;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("支付异步回调接口");
	}

	@Before
	public void caseUp() {
		wxnotifyBean = new WeiXinNotifyBean();
		alinotifyBean = new AliPayNotifyBean();
		notifyCall = new NotifyCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(notifyCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_Notify_001() {
		Logger.start(true, "10支付宝PC支付异步回调成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("10");
			alinotifyBean = initAliPayNotifyBean(aqb);
			String send = aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);

			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
			
			verifyDB(aqb, alinotifyBean);
			
			List<Map> mocks=new PaymentDefaultWapper().selectMockHttpRecordByMockId(mockid);
			for (Map mock : mocks) {
				Map body= (Map) FormatUtil.GSONToObject(mock.get("Body").toString(), Map.class) ;
				Logger.verifyEquals(alinotifyBean.getBuyer_email(), body.get("externalUserId").toString(), "验证externalUserId");
				Logger.verifyEquals(alinotifyBean.getBuyer_id(), body.get("externalPayerId").toString(), "验证externalPayerId");
				Logger.verifyEquals( Double.valueOf(alinotifyBean.getPrice()), Double.valueOf(body.get("payPrice").toString()), "验证payPrice");
				Logger.verifyEquals(alinotifyBean.getOut_trade_no(), body.get("paymentId").toString(), "验证paymentId");
				Logger.verifyEquals("Alipay", body.get("payChannel").toString(), "验证payChannel");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_002() {
		Logger.start(true, "11.支付宝WAP支付异步回调成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("11");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("11");
			AliPayWapNotifyBean aliwap=PaymentProxyCallService.initAliPayWapNotify(aqb);
			String send = PaymentProxyCallService.signAliWapNotify(aliwap);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
			verifyWapDB(aqb, aliwap);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_003() {
		Logger.start(true, "13.支付宝-APP支付异步回调成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("13");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("13");
			alinotifyBean = initAliPayNotifyBean(aqb);
			String send = aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, alinotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_004() {
		Logger.start(true, "14.微信JSAPI支付异步回调成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>",
					notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, wxnotifyBean);
			List<Map> mocks=new PaymentDefaultWapper().selectMockHttpRecordByMockId(mockid);
			for (Map mock : mocks) {
				Logger.debug(mock);
				Map body= (Map) FormatUtil.GSONToObject(mock.get("Body").toString(), Map.class) ;
				Logger.verifyEquals(wxnotifyBean.getOut_trade_no(), body.get("paymentId").toString(), "验证paymentId");
				Logger.verifyEquals("Weixin", body.get("payChannel").toString(), "验证payChannel");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_005() {
		Logger.start(true, "15.微信APP支付异步回调成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>",
					notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, wxnotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_Notify_006() {
		Logger.start(false, "10支付宝PC支付签名错误,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("10");
			alinotifyBean = initAliPayNotifyBean(aqb);
			Logger.comment("AliPayNotifyBean加签并转换为SendString，设置sign错误");
			// 排序加签名
			String src = FormatUtil.beanToHttpString(alinotifyBean, false);
			String sign = SignSHA1WithRSA(src);
			alinotifyBean.setSign(sign + 1);
			alinotifyBean.setSign_type("RSA");
			// 转换成最终发出的数据
			String send = FormatUtil.beanToHttpString(alinotifyBean, true);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_007() {
		Logger.start(false, "10支付宝PC支付Out_trade_no错误,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("10");
			alinotifyBean = initAliPayNotifyBean(aqb);
			Logger.comment("设置错误的Out_trade_no:123");
			alinotifyBean.setOut_trade_no("123");
			String send =  aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_008() {
		Logger.start(false, "10支付宝PC支付Out_trade_no不输入,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("10");
			alinotifyBean = initAliPayNotifyBean(aqb);
			Logger.comment("设置Out_trade_no:null");
			alinotifyBean.setOut_trade_no(null);
			String send =  aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_009() {
		Logger.start(false, "13.支付宝-APP支付签名错误异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("13");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("13");
			alinotifyBean = initAliPayNotifyBean(aqb);
			Logger.comment("AliPayNotifyBean加签并转换为SendString，设置sign错误");
			// 排序加签名
			String src = FormatUtil.beanToHttpString(alinotifyBean, false);
			String sign = SignSHA1WithRSA(src);
			alinotifyBean.setSign(sign + 1);
			alinotifyBean.setSign_type("RSA");
			// 转换成最终发出的数据
			String send = FormatUtil.beanToHttpString(alinotifyBean, true);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_010() {
		Logger.start(false, "13.支付宝-APP支付Out_trade_no错误,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("13");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("13");
			alinotifyBean = initAliPayNotifyBean(aqb);
			Logger.comment("设置错误的Out_trade_no:123");
			alinotifyBean.setOut_trade_no("123");
			String send =  aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_011() {
		Logger.start(false, "13.支付宝-APP支付不输入Out_trade_no,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("13");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("13");
			alinotifyBean = initAliPayNotifyBean(aqb);
			Logger.comment("设置错误的Out_trade_no:null");
			alinotifyBean.setOut_trade_no(null);
			String send =  aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_012() {
		Logger.start(false, "14.微信JSAPI支付签名错误异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			// 排序加签名
			String src = FormatUtil.beanToHttpString(wxnotifyBean, false);
			String sign = SignSHA1WithRSA(src);
			Logger.comment("设置签名错误");
			wxnotifyBean.setSign(sign + 1);
			// 转换成最终发出的数据
			String send = FormatUtil.beanToXmlString(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_013() {
		Logger.start(false, "14.微信JSAPI支付Out_trade_no错误,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setOut_trade_no("123");
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_014() {
		Logger.start(false, "14.微信JSAPI支付MerchantId错误,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setMch_id("123");
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_015() {
		Logger.start(false, "14.微信JSAPI支付ResultCode失败,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setResult_code("FAIL");
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_016() {
		Logger.start(false, "14.微信JSAPI支付ReturnCode失败,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setReturn_code("FAIL");
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_017() {
		Logger.start(false, "14.微信JSAPI支付TransactionID空值,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setTransaction_id(null);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_018() {
		Logger.start(false, "14.微信JSAPI支付TotalFee小于0,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setTotal_fee("-1");
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_019() {
		Logger.start(false, "14.微信JSAPI支付Out_trade_no为空,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setOut_trade_no(null);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_020() {
		Logger.start(false, "15.微信APP支付签名错误异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			// 排序加签名
			String src = FormatUtil.beanToHttpString(wxnotifyBean, false);
			String sign = SignSHA1WithRSA(src);
			Logger.comment("设置签名错误");
			wxnotifyBean.setSign(sign + 1);
			// 转换成最终发出的数据
			String send = FormatUtil.beanToXmlString(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_021() {
		Logger.start(false, "15.微信APP支付Out_trade_no错误,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setOut_trade_no("123");
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_022() {
		Logger.start(false, "15.微信APP支付MerchantId错误,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setMch_id("123");
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_023() {
		Logger.start(false, "15.微信APP支付ResultCode失败,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setResult_code("FAIL");
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_024() {
		Logger.start(false, "15.微信APP支付ReturnCode失败,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setReturn_code("FAIL");
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_025() {
		Logger.start(false, "15.微信APP支付TransactionID空值,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setTransaction_id(null);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_026() {
		Logger.start(false, "15.微信APP支付TotalFee小于0,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setTotal_fee("-1");
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_027() {
		Logger.start(false, "15.微信APP支付Out_trade_no为空,异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setOut_trade_no(null);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_Notify_028() {
		Logger.start(false, "10支付宝PC支付金额错误异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("10");
			alinotifyBean = initAliPayNotifyBean(aqb);
			alinotifyBean.setTotal_fee(alinotifyBean.getTotal_fee() + 1);
			String send =  aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_029() {
		Logger.start(false, "13.支付宝-APP支付金额错误异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("13");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("13");
			alinotifyBean = initAliPayNotifyBean(aqb);
			alinotifyBean.setTotal_fee(alinotifyBean.getTotal_fee() + 1);
			String send =  aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_030() {
		Logger.start(false, "14.微信JSAPI支付金额错误异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setTotal_fee(wxnotifyBean.getTotal_fee() + 1);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_031() {
		Logger.start(false, "15.微信APP支付金额错误异步回调失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setTotal_fee(wxnotifyBean.getTotal_fee() + 1);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_032() {
		Logger.start(true, "收单时bizcode1，10支付宝PC支付异步回调校验PostPay100002补款充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			aqb.setBizCode("1");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("10");
			alinotifyBean = initAliPayNotifyBean(aqb);
			String send =  aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, alinotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	@Ignore
	//bizcode2 此业务废弃
	public void Tc_Notify_033() {
		Logger.start(true, "收单时bizcode2，10支付宝PC支付异步回调校验Recharge100003现金充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			aqb.setBizCode("2");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("10");
			alinotifyBean = initAliPayNotifyBean(aqb);
			String send = aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, alinotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_034() {
		Logger.start(true, "收单时bizcode3，10支付宝PC支付异步回调校验PayRecharge100001定金充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			aqb.setBizCode("3");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("10");
			alinotifyBean = initAliPayNotifyBean(aqb);
			String send =  aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, alinotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_035() {
		Logger.start(true, "收单时bizcode4，10支付宝PC支付异步回调校验SellerMarginRecharge100003卖家保证金充值补款充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			aqb.setBizCode("4");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("10");
			alinotifyBean = initAliPayNotifyBean(aqb);
			String send = aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, alinotifyBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_036() {
		Logger.start(true, "收单时bizcode5，10支付宝PC支付异步回调校验SellerRecharge100003卖家余额充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			aqb.setBizCode("5");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("10");
			alinotifyBean = initAliPayNotifyBean(aqb);
			String send =  aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, alinotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_037() {
		Logger.start(true, "收单时bizcode1，13.支付宝-APP支付异步回调校验PostPay100002补款充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("13");
			aqb.setBizCode("1");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("13");
			alinotifyBean = initAliPayNotifyBean(aqb);
			String send =  aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, alinotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	@Ignore
	//bizcode2 此业务废弃
	public void Tc_Notify_038() {
		Logger.start(true, "收单时bizcode2，13.支付宝-APP支付异步回调校验Recharge100003现金充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("13");
			aqb.setBizCode("2");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("13");
			alinotifyBean = initAliPayNotifyBean(aqb);
			String send =  aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, alinotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_039() {
		Logger.start(true, "收单时bizcode3，13.支付宝-APP支付异步回调校验PayRecharge100001定金充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("13");
			aqb.setBizCode("3");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("13");
			alinotifyBean = initAliPayNotifyBean(aqb);
			String send =  aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, alinotifyBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_040() {
		Logger.start(true, "收单时bizcode4，13.支付宝-APP支付异步回调校验SellerMarginRecharge100003卖家保证金充值补款充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("13");
			aqb.setBizCode("4");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("13");
			alinotifyBean = initAliPayNotifyBean(aqb);
			String send = aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, alinotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_041() {
		Logger.start(true, "收单时bizcode5，13.支付宝-APP支付异步回调校验SellerRecharge100003卖家余额充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("13");
			aqb.setBizCode("5");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("13");
			alinotifyBean = initAliPayNotifyBean(aqb);
			String send =  aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, alinotifyBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_042() {
		Logger.start(true, "收单时bizcode1，14微信JSAPI支付异步回调校验PostPay100002补款充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			aqb.setBizCode("1");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>",
					notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, wxnotifyBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	@Ignore
	//bizcode2 此业务废弃
	public void Tc_Notify_043() {
		Logger.start(true, "收单时bizcode2，14微信JSAPI支付异步回调校验Recharge100003现金充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			aqb.setBizCode("2");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>",
					notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, wxnotifyBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_044() {
		Logger.start(true, "收单时bizcode3，14微信JSAPI支付异步回调校验PayRecharge100001定金充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			aqb.setBizCode("3");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>",
					notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, wxnotifyBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_045() {
		Logger.start(true, "收单时bizcode4，14微信JSAPI支付异步回调校验SellerMarginRecharge100003卖家保证金充值补款充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			aqb.setBizCode("4");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>",
					notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, wxnotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_046() {
		Logger.start(true, "收单时bizcode5，14微信JSAPI支付异步回调校验SellerRecharge100003卖家余额充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			aqb.setBizCode("5");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>",
					notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, wxnotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_047() {
		Logger.start(true, "收单时bizcode1，15微信APP支付异步回调校验PostPay100002补款充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			aqb.setBizCode("1");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>",
					notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, wxnotifyBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	@Ignore
	//bizcode2 此业务废弃
	public void Tc_Notify_048() {
		Logger.start(true, "收单时bizcode2，15微信APP支付异步回调校验Recharge100003现金充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			aqb.setBizCode("2");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>",
					notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, wxnotifyBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_049() {
		Logger.start(true, "收单时bizcode3，15微信APP支付异步回调校验PayRecharge100001定金充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			aqb.setBizCode("3");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>",
					notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, wxnotifyBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_050() {
		Logger.start(true, "收单时bizcode4，15微信APP支付异步回调校验SellerMarginRecharge100003卖家保证金充值补款充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			aqb.setBizCode("4");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>",
					notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, wxnotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_051() {
		Logger.start(true, "收单时bizcode5，15微信APP支付异步回调校验SellerRecharge100003卖家余额充值成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			aqb.setBizCode("5");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>",
					notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, wxnotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_Notify_052() {
		Logger.start(true, "10支付宝PC输入错误商户号支付异步回调失败JIRACONN-4583");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("10");
			alinotifyBean = initAliPayNotifyBean(aqb);
			alinotifyBean.setSeller_id(alinotifyBean.getSeller_id()+1);
			String send = aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);

			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();

			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Notify_053() {
		Logger.start(true, "11.支付宝WAP支付输入错误商户号异步回调失败JIRACONN-4583");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("11");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("11");
			AliPayWapNotifyBean aliwap=PaymentProxyCallService.initAliPayWapNotify(aqb);
			aliwap.setSeller_id(aliwap.getSeller_id()+1);
			String send = PaymentProxyCallService.signAliWapNotify(aliwap);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_054() {
		Logger.start(true, "13.支付宝-APP支付输入错误商户号异步回调失败JIRACONN-4583");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("13");
			PaymentProxyCallService.acquireOrder(aqb);
			notifyCall = new NotifyCall("13");
			alinotifyBean = initAliPayNotifyBean(aqb);
			alinotifyBean.setSeller_id(alinotifyBean.getSeller_id()+1);
			String send = aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_055() {
		Logger.start(true, "14.微信JSAPI支付输入错误商户号异步回调失败JIRACONN-4583");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("14");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setMch_id(wxnotifyBean.getMch_id()+1);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_056() {
		Logger.start(true, "15.微信APP支付输入错误商户号异步回调失败JIRACONN-4583");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("15");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setMch_id(wxnotifyBean.getMch_id()+1);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("failed", notifyCall.getReturnData(), "验证failed");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_Notify_057() {
		Logger.start(true, "50招行支付异步回调成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("50");
			PaymentProxyCallService.acquireOrder(aqb);

			NotifyCall50 notifyCall50 = new NotifyCall50();
			cmbNotifyBean=PaymentProxyCallService.initCMBNotifyBean(aqb,"0");
			String sign=PaymentProxyCallService.SignCMBNoticeData(cmbNotifyBean.getNoticeData());
			cmbNotifyBean.setSign(sign);
			String send = PaymentProxyCallService.CMBNoticeSendString(cmbNotifyBean);
//			alinotifyBean = initAliPayNotifyBean(aqb);
//			String send = aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall50.setData(send);
			notifyCall50.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall50.addHeader("MockId", mockid);

			Logger.comment("添加Mock:" + mockid);
			notifyCall50.callService();

			Logger.verifyEquals("success", notifyCall50.getReturnData(), "验证success");
			List<Map> mocks=new PaymentDefaultWapper().selectMockHttpRecordByMockId(mockid);
			
			verifyDB(aqb, cmbNotifyBean);
			for (Map mock : mocks) {
				Logger.debug(mock);
				Map body= (Map) FormatUtil.GSONToObject(mock.get("Body").toString(), Map.class) ;
//				Logger.verifyEquals(cmbNotifyBean.getBuyer_email(), body.get("externalUserId").toString(), "验证externalUserId");
//				Logger.verifyEquals(cmbNotifyBean.getBuyer_id(), body.get("externalPayerId").toString(), "验证externalPayerId");
//				Logger.verifyEquals( Double.valueOf(cmbNotifyBean.getPrice()), Double.valueOf(body.get("payPrice").toString()), "验证payPrice");
				Logger.verifyEquals(cmbNotifyBean.getNoticeData().getOrderNo(), body.get("paymentId").toString(), "验证paymentId");
				Logger.verifyEquals("CmbPay", body.get("payChannel").toString(), "验证payChannel");
				
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_Notify_058() {
		Logger.start(true, "50招行支付异步回调成功,有优惠金额");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("50");
			PaymentProxyCallService.acquireOrder(aqb);

			NotifyCall50 notifyCall50 = new NotifyCall50();
			cmbNotifyBean=PaymentProxyCallService.initCMBNotifyBean(aqb,"1");
			String sign=PaymentProxyCallService.SignCMBNoticeData(cmbNotifyBean.getNoticeData());
			cmbNotifyBean.setSign(sign);
			String send = PaymentProxyCallService.CMBNoticeSendString(cmbNotifyBean);
//			alinotifyBean = initAliPayNotifyBean(aqb);
//			String send = aliPayNotifyBeanToSend(alinotifyBean,aqb);
			notifyCall50.setData(send);
			notifyCall50.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall50.addHeader("MockId", mockid);

			Logger.comment("添加Mock:" + mockid);
			notifyCall50.callService();

			Logger.verifyEquals("success", notifyCall50.getReturnData(), "验证success");
			List<Map> mocks=new PaymentDefaultWapper().selectMockHttpRecordByMockId(mockid);
			
			verifyDB(aqb, cmbNotifyBean);
			for (Map mock : mocks) {
				Logger.debug(mock);
				Map body= (Map) FormatUtil.GSONToObject(mock.get("Body").toString(), Map.class) ;
//				Logger.verifyEquals(cmbNotifyBean.getBuyer_email(), body.get("externalUserId").toString(), "验证externalUserId");
//				Logger.verifyEquals(cmbNotifyBean.getBuyer_id(), body.get("externalPayerId").toString(), "验证externalPayerId");
//				Logger.verifyEquals( Double.valueOf(cmbNotifyBean.getPrice()), Double.valueOf(body.get("payPrice").toString()), "验证payPrice");
				Logger.verifyEquals(cmbNotifyBean.getNoticeData().getOrderNo(), body.get("paymentId").toString(), "验证paymentId");
				Logger.verifyEquals("CmbPay", body.get("payChannel").toString(), "验证payChannel");
				
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Notify_059() {
		Logger.start(true, "16.微信扫描支付异步回调成功,openid为空");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("16");
			PaymentProxyCallService.acquireOrder(aqb);

			notifyCall = new NotifyCall("16");
			wxnotifyBean = initWeixinBean(aqb);
			wxnotifyBean.setOpenid(null);
			String send = weiXinNotifyBeanToSend(wxnotifyBean);
			notifyCall.setData(send);
			notifyCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			notifyCall.addHeader("MockId", mockid);
			Logger.comment("添加Mock:" + mockid);
			notifyCall.callService();
			Logger.verifyEquals("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>",
					notifyCall.getReturnData(), "验证success");
			verifyDB(aqb, wxnotifyBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	private void verifyDB(AcquireOrderBean aqb,  CMBNotifyBean cmbnotifybean) throws InterruptedException {
		Logger.comment("验证pp_payment");
		PPBussinessOrder ppb = new PaymentDefaultWapper().selectPPBussinessorderByTraceId(aqb.getTraceId()).get(0);
		
		String businessoid = ppb.getBussinessOrderId();
		PPPayment ppm = new PaymentDefaultWapper().selectPPPaymentByBussinessOrderId(businessoid).get(0);
		if(ppm.getInstitutionPaymentId()==null){
			Thread.sleep(5000);
			ppm = new PaymentDefaultWapper().selectPPPaymentByBussinessOrderId(businessoid).get(0);
		}
		Logger.verifyEquals(PayOrderEnum.Success.getValue(), ppm.getPayStatus(), "验证PayStatus");
		Logger.verifyEquals("CNY", ppm.getActualPayCurrencyType(), "验证ActualPayCurrencyType");
		Logger.verifyEquals(cmbnotifybean.getNoticeData().getBankSerialNo(), ppm.getInstitutionPaymentId(), "验证InstitutionPaymentId");
		
		Logger.verifyEquals(Double.valueOf(cmbnotifybean.getNoticeData().getDiscountAmount()), Double.valueOf(ppm.getDiscountAmt()), "验证DiscountAmt");
		Double app=Double.valueOf(aqb.getPayPrice())-Double.valueOf(cmbNotifyBean.getNoticeData().getDiscountAmount());
		Logger.verifyEquals(app,Double.valueOf(ppm.getActualPayPrice().toString()),"验证ActualPayPrice");
		
		// ?getExchangeRate待确认
		Logger.verifyEquals(1d, ppm.getExchangeRate(), "验证ExchangeRate");
		Logger.comment("验证YmtAccountEntry");
		String pid = ppm.getPaymentId();
        Map m = new HashMap();
        m.put("bizno", pid);
		YmtAccountEntry actinfo = new AccountDefaultWapper().selectAccountEntryByBizNo(m).get(0);
		Logger.debug(FormatUtil.beanToGSONString(actinfo));
		Logger.verifyEquals(aqb.getUserId(), actinfo.getUserid().toString(), "验证Userid");
		Logger.verifyEquals(0, actinfo.getAmount().compareTo(new BigDecimal(aqb.getPayPrice())),
				"验证PayPrice:" + aqb.getPayPrice());
		// 入账 type 2
		Logger.verifyEquals("2", actinfo.getEntrytype().toString(), "验证Entrytype");
		Logger.verifyEquals(pid, actinfo.getBizno(), "验证Bizno为PaymentId");
		Logger.verifyEquals(aqb.getOrderId(), actinfo.getOriginalno(), "验证Originalno为orderid");
		Map nactinfo = new AccountDefaultWapper().selectAccountInfo(actinfo.getAccountid()).get(0);
		if (aqb.getBizCode().equals("1")) {
			Logger.verifyEquals("100002", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("补款充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("1", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		} else if (aqb.getBizCode().equals("2")) {
			Logger.verifyEquals("100003", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("现金充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("1", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		} else if (aqb.getBizCode().equals("3")) {
			Logger.verifyEquals("100001", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("定金充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("1", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		} else if (aqb.getBizCode().equals("4")) {
			Logger.verifyEquals("100003", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("卖家保证金充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("11", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1001", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		}

//		Logger.comment("验证PP_CompensateProcessInfo（发货补偿信息）");
//		PPCompensateProcessInfo ppCompensateProcessInfo = new PaymentDefaultWapper()
//				.selectPPCompensateProcessInfoByCorrelateId(pid).get(0);
//		Logger.verifyEquals("1", ppCompensateProcessInfo.getAppId(), "验证PP_CompensateProcessInfo表中AppId字段为1");
//		Logger.verifyEquals("DeliveryNotify", ppCompensateProcessInfo.getMethodName(),
//				"验证PP_CompensateProcessInfo表中MethodName字段为DeliveryNotify");
//		Logger.verifyEquals(null, ppCompensateProcessInfo.getCompensateType(),
//				"验证PP_CompensateProcessInfo表中CompensateType字段为NULL:支付");
	}
	// @Test
	// @Category(P2.class)
	// @TestCase
	// @i
	// public void Tc_Notify_052() {
	// Logger.start(true, "使用交易服务生成的订单数据调用13.支付宝-APP支付异步回调成功");
	// try {
	// AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("13");
	// aqb.setOrderId("8629202");
	// aqb.setPayPrice("265");
	// aqb.setUserId("20238699");
	// aqb.setProductName("接口自动化测试Test");
	// notifyCall = new NotifyCall("13");
	// alinotifyBean = initAliPayNotifyBean(aqb);
	// String send = aliPayNotifyBeanToSend(alinotifyBean);
	// notifyCall.setData(send);
	// notifyCall.addHeader("Mock", "1");
	// String mockid = TestDataManager.getRandomUUID().toString();
	// notifyCall.addHeader("MockId", mockid);
	// Logger.comment("添加Mock:" + mockid);
	// notifyCall.callService();
	// Logger.verifyEquals("success", notifyCall.getReturnData(), "验证success");
	// } catch (Exception e) {
	// Logger.fail(e);
	// }
	// }
	/**
	 * db验证 用于阿里支付
	 * 
	 * @param aqb
	 * @param alinotifyBean1
	 * @throws InterruptedException
	 */
	private void verifyDB(AcquireOrderBean aqb, AliPayNotifyBean alinotifyBean1) throws InterruptedException {
		Logger.comment("验证pp_payment");
		PPBussinessOrder ppb = new PaymentDefaultWapper().selectPPBussinessorderByTraceId(aqb.getTraceId()).get(0);
		
		String businessoid = ppb.getBussinessOrderId();
		PPPayment ppm = new PaymentDefaultWapper().selectPPPaymentByBussinessOrderId(businessoid).get(0);
		if(ppm.getInstitutionPaymentId()==null){
			Thread.sleep(5000);
			ppm = new PaymentDefaultWapper().selectPPPaymentByBussinessOrderId(businessoid).get(0);
		}
		Logger.verifyEquals(PayOrderEnum.Success.getValue(), ppm.getPayStatus(), "验证PayStatus");
		Logger.verifyEquals("CNY", ppm.getActualPayCurrencyType(), "验证ActualPayCurrencyType");
		Logger.verifyEquals(alinotifyBean1.getTrade_no(), ppm.getInstitutionPaymentId(), "验证InstitutionPaymentId");
		// ?getExchangeRate待确认
		Logger.verifyEquals(1d, ppm.getExchangeRate(), "验证ExchangeRate");
		Logger.verifyEquals(alinotifyBean1.getBuyer_id(), ppm.getPayerId(), "验证PayerId");
		Logger.verifyEquals(alinotifyBean1.getBuyer_email(), ppm.getPayerEmail(), "验证PayerEmail");
		Logger.comment("验证YmtAccountEntry");
		String pid = ppm.getPaymentId();
        Map m = new HashMap();
        m.put("bizno", pid);
		YmtAccountEntry actinfo = new AccountDefaultWapper().selectAccountEntryByBizNo(m).get(0);
		Logger.debug(FormatUtil.beanToGSONString(actinfo));
		Logger.verifyEquals(aqb.getUserId(), actinfo.getUserid().toString(), "验证Userid");
		Logger.verifyEquals(0, actinfo.getAmount().compareTo(new BigDecimal(aqb.getPayPrice())),
				"验证PayPrice:" + aqb.getPayPrice());
		// 入账 type 2
		Logger.verifyEquals("2", actinfo.getEntrytype().toString(), "验证Entrytype");
		Logger.verifyEquals(pid, actinfo.getBizno(), "验证Bizno为PaymentId");
		Logger.verifyEquals(aqb.getOrderId(), actinfo.getOriginalno(), "验证Originalno为orderid");
		Map nactinfo = new AccountDefaultWapper().selectAccountInfo(actinfo.getAccountid()).get(0);
		if (aqb.getBizCode().equals("1")) {
			Logger.verifyEquals("100002", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("补款充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("1", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		} else if (aqb.getBizCode().equals("2")) {
			Logger.verifyEquals("100003", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("现金充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("1", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		} else if (aqb.getBizCode().equals("3")) {
			Logger.verifyEquals("100001", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("定金充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("1", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		} else if (aqb.getBizCode().equals("4")) {
			Logger.verifyEquals("100003", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("卖家保证金充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("11", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1001", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		}

//		Logger.comment("验证PP_CompensateProcessInfo（发货补偿信息）");
//		PPCompensateProcessInfo ppCompensateProcessInfo = new PaymentDefaultWapper()
//				.selectPPCompensateProcessInfoByCorrelateId(pid).get(0);
//		Logger.verifyEquals("1", ppCompensateProcessInfo.getAppId(), "验证PP_CompensateProcessInfo表中AppId字段为1");
//		Logger.verifyEquals("DeliveryNotify", ppCompensateProcessInfo.getMethodName(),
//				"验证PP_CompensateProcessInfo表中MethodName字段为DeliveryNotify");
//		Logger.verifyEquals(null, ppCompensateProcessInfo.getCompensateType(),
//				"验证PP_CompensateProcessInfo表中CompensateType字段为NULL:支付");
	}
	/**
	 * db验证 用于阿里支付
	 * 
	 * @param aqb
	 * @param alinotifyBean1
	 * @throws InterruptedException
	 */
	private void verifyWapDB(AcquireOrderBean aqb, AliPayWapNotifyBean awb) throws InterruptedException {
		Logger.comment("验证pp_payment");
		PPBussinessOrder ppb = new PaymentDefaultWapper().selectPPBussinessorderByTraceId(aqb.getTraceId()).get(0);
		
		String businessoid = ppb.getBussinessOrderId();
		PPPayment ppm = new PaymentDefaultWapper().selectPPPaymentByBussinessOrderId(businessoid).get(0);
		if(ppm.getInstitutionPaymentId()==null){
			Thread.sleep(5000);
			ppm = new PaymentDefaultWapper().selectPPPaymentByBussinessOrderId(businessoid).get(0);
		}
		
		Logger.verifyEquals(PayOrderEnum.Success.getValue(), ppm.getPayStatus(), "验证PayStatus");
		Logger.verifyEquals("CNY", ppm.getActualPayCurrencyType(), "验证ActualPayCurrencyType");
		Logger.verifyEquals(awb.getTrade_no(), ppm.getInstitutionPaymentId(), "验证InstitutionPaymentId");
		// ?getExchangeRate待确认
		Logger.verifyEquals(1d, ppm.getExchangeRate(), "验证ExchangeRate");
		Logger.verifyEquals(awb.getBuyer_id(), ppm.getPayerId(), "验证PayerId");
		Logger.verifyEquals(awb.getBuyer_email(), ppm.getPayerEmail(), "验证PayerEmail");
		Logger.comment("验证YmtAccountEntry");
		String pid = ppm.getPaymentId();
        Map m = new HashMap();
        m.put("bizno", pid);
		YmtAccountEntry actinfo = new AccountDefaultWapper().selectAccountEntryByBizNo(m).get(0);
		Logger.debug(FormatUtil.beanToGSONString(actinfo));
		Logger.verifyEquals(aqb.getUserId(), actinfo.getUserid().toString(), "验证Userid");
		Logger.verifyEquals(0, actinfo.getAmount().compareTo(new BigDecimal(aqb.getPayPrice())),
				"验证PayPrice:" + aqb.getPayPrice());
		// 入账 type 2
		Logger.verifyEquals("2", actinfo.getEntrytype().toString(), "验证Entrytype");
		Logger.verifyEquals(pid, actinfo.getBizno(), "验证Bizno为PaymentId");
		Logger.verifyEquals(aqb.getOrderId(), actinfo.getOriginalno(), "验证Originalno为orderid");
		Map nactinfo = new AccountDefaultWapper().selectAccountInfo(actinfo.getAccountid()).get(0);
		if (aqb.getBizCode().equals("1")) {
			Logger.verifyEquals("100002", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("补款充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("1", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		} else if (aqb.getBizCode().equals("2")) {
			Logger.verifyEquals("100003", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("现金充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("1", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		} else if (aqb.getBizCode().equals("3")) {
			Logger.verifyEquals("100001", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("定金充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("1", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		} else if (aqb.getBizCode().equals("4")) {
			Logger.verifyEquals("100003", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("卖家保证金充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("11", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1001", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		}

//		Logger.comment("验证PP_CompensateProcessInfo（发货补偿信息）");
//		PPCompensateProcessInfo ppCompensateProcessInfo = new PaymentDefaultWapper()
//				.selectPPCompensateProcessInfoByCorrelateId(pid).get(0);
//		Logger.verifyEquals("1", ppCompensateProcessInfo.getAppId(), "验证PP_CompensateProcessInfo表中AppId字段为1");
//		Logger.verifyEquals("DeliveryNotify", ppCompensateProcessInfo.getMethodName(),
//				"验证PP_CompensateProcessInfo表中MethodName字段为DeliveryNotify");
//		Logger.verifyEquals(null, ppCompensateProcessInfo.getCompensateType(),
//				"验证PP_CompensateProcessInfo表中CompensateType字段为NULL:支付");
	}
	/**
	 * db验证 用于微信支付
	 * 
	 * @param aqb
	 * @param alinotifyBean1
	 * @throws InterruptedException
	 */
	private void verifyDB(AcquireOrderBean aqb, WeiXinNotifyBean wxnotifbean) throws InterruptedException {
		Logger.comment("验证pp_payment");
		PPBussinessOrder ppb = new PaymentDefaultWapper().selectPPBussinessorderByTraceId(aqb.getTraceId()).get(0);
		String businessoid = ppb.getBussinessOrderId();
		PPPayment ppm = new PaymentDefaultWapper().selectPPPaymentByBussinessOrderId(businessoid).get(0);
		Logger.verifyEquals(PayOrderEnum.Success.getValue(), ppm.getPayStatus(), "验证PayStatus");
		Logger.verifyEquals("CNY", ppm.getActualPayCurrencyType(), "验证ActualPayCurrencyType");
		Logger.verifyEquals(wxnotifbean.getTransaction_id(), ppm.getInstitutionPaymentId(), "验证InstitutionPaymentId");
		// ?getExchangeRate待确认
		Logger.verifyEquals(1d, ppm.getExchangeRate(), "验证ExchangeRate");
		Logger.verifyEquals(wxnotifbean.getOpenid(), ppm.getPayerId(), "验证PayerId");
		Logger.comment("验证YmtAccountEntry");
		String pid = ppm.getPaymentId();
		Logger.verifyEquals(pid, wxnotifbean.getOut_trade_no(), "验证weixinbean.Out_trade_no为PaymentId");
        Map m = new HashMap();
        m.put("bizno", pid);
		YmtAccountEntry actinfo = new AccountDefaultWapper().selectAccountEntryByBizNo(m).get(0);
		Logger.debug(FormatUtil.beanToGSONString(actinfo));
		Logger.verifyEquals(aqb.getUserId(), actinfo.getUserid().toString(), "验证Userid");
		Logger.verifyEquals(0, actinfo.getAmount().compareTo(new BigDecimal(aqb.getPayPrice())),
				"验证PayPrice:" + aqb.getPayPrice());
		// 入账 type 2
		Logger.verifyEquals("2", actinfo.getEntrytype().toString(), "验证Entrytype");
		Logger.verifyEquals(pid, actinfo.getBizno(), "验证Bizno为PaymentId");
		Logger.verifyEquals(aqb.getOrderId(), actinfo.getOriginalno(), "验证Originalno为orderid");
		Map nactinfo = new AccountDefaultWapper().selectAccountInfo(actinfo.getAccountid()).get(0);
		if (aqb.getBizCode().equals("1")) {
			Logger.verifyEquals("100002", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("补款充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("1", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		} else if (aqb.getBizCode().equals("2")) {
			Logger.verifyEquals("100003", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("现金充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("1", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		} else if (aqb.getBizCode().equals("3")) {
			Logger.verifyEquals("100001", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("定金充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("1", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		} else if (aqb.getBizCode().equals("4")) {
			Logger.verifyEquals("100003", actinfo.getBizcode().toString(), "验证Bizcode");
			Logger.verifyEquals("卖家保证金充值", actinfo.getMemo(), "验证Memo");
			Logger.comment("验证AccountInfo:卖家保证金充值");
			Logger.verifyEquals("11", nactinfo.get("iAccountType").toString(), "验证iAccountType");
			Logger.verifyEquals("1001", nactinfo.get("iCurrencyType").toString(), "验证iCurrencyType");
		}

//		Logger.comment("验证PP_CompensateProcessInfo（发货补偿信息）");
//		PPCompensateProcessInfo ppCompensateProcessInfo = new PaymentDefaultWapper()
//				.selectPPCompensateProcessInfoByCorrelateId(pid).get(0);
//		Logger.verifyEquals("1", ppCompensateProcessInfo.getAppId(), "验证PP_CompensateProcessInfo表中AppId字段为1");
//		Logger.verifyEquals("DeliveryNotify", ppCompensateProcessInfo.getMethodName(),
//				"验证PP_CompensateProcessInfo表中MethodName字段为DeliveryNotify");
//		Logger.verifyEquals(null, ppCompensateProcessInfo.getCompensateType(),
//				"验证PP_CompensateProcessInfo表中CompensateType字段为NULL:支付");

	}

	/**
	 * AliPayNotifyBean加签并转换为SendString
	 * 
	 * @param alipaybean
	 * @param aqb 
	 * @return
	 * @throws Exception
	 */
	private String aliPayNotifyBeanToSend(AliPayNotifyBean alipaybean, AcquireOrderBean aqb) throws Exception {
		Logger.comment("AliPayNotifyBean加签并转换为SendString");
		String send = null;
		if (aqb.getPayType().equals("13")) {
			// 排序加签名
			String src = FormatUtil.beanToHttpString(alinotifyBean, false);
			String sign =  new Sign().SignSHA1WithRSA(src);
			alinotifyBean.setSign(sign);
			alinotifyBean.setSign_type("RSA");
			// 转换成最终发出的数据
			send = FormatUtil.beanToHttpString(alinotifyBean, true);
		} else {
			String src = FormatUtil.beanToHttpString(alinotifyBean, false);
			String sign = new Sign().signMd5(alinotifyBean, Sign.autoTestKey);
			alinotifyBean.setSign(sign);
			alinotifyBean.setSign_type("MD5");
			send = FormatUtil.beanToHttpString(alinotifyBean, true);
		}
		return send;
	}

	/**
	 * WeiXinNotifyBean加签并转换为SendString
	 * 
	 * @param weixinbean
	 * @return
	 * @throws Exception
	 */
	public static String weiXinNotifyBeanToSend(WeiXinNotifyBean weixinbean) throws Exception {
    	Logger.comment("WeiXinNotifyBean加签并转换为SendString");
        // 排序加签名
        //String src = FormatUtil.beanToHttpString(weixinbean, false);
        //String sign = SignSHA1WithRSA(src);
        
		String sign = new Sign().signMd5(weixinbean, "&key=" + Sign.autoTestKey);
		weixinbean.setSign(sign);
		
        // 转换成最终发出的数据
        String send = FormatUtil.beanToXmlString(weixinbean);
        return send;
	}

	/**
	 * 初始化 AliPayNotifyBean
	 * 
	 * @param aqb
	 * @return
	 * @throws InterruptedException
	 */
	private AliPayNotifyBean initAliPayNotifyBean(AcquireOrderBean aqb) throws InterruptedException {
		alinotifyBean.setBody("自动化测试订单");
		alinotifyBean.setBusiness_scene("qrpay");
		alinotifyBean.setBuyer_email(TestDataManager.getEmail());
		alinotifyBean.setBuyer_id("2088" + TestDataManager.getRandomNum(10));
		alinotifyBean.setDiscount("0");
		alinotifyBean.setExtra_common_param("自动化测试回传参数");
		alinotifyBean.setGmt_close(YMTDateUtil.getBeforeOrNextDay(1));
		alinotifyBean.setGmt_create(YMTDateUtil.getBeforeOrNextSecond(1));
		alinotifyBean.setGmt_payment(YMTDateUtil.getBeforeOrNextSecond(2));
		alinotifyBean.setGmt_refund(null);
		alinotifyBean.setIs_total_fee_adjust("N");
		alinotifyBean.setNotify_id(TestDataManager.getClientpaymentId());
		alinotifyBean.setNotify_time(YMTDateUtil.getBeforeOrNextSecond(3));
		alinotifyBean.setNotify_type("trade_status_sync");
		// trandno 是PaymentId
		// PPBussinessorder ppb = new
		// PaymentDefaultWapper().selectPPBussinessorderByTraceId(aqb.getTraceId()).get(0);
		PPBussinessOrder ppb = new PaymentDefaultWapper().selectPPBussinessorderByOrderId(aqb.getOrderId()).get(0);
		String businessoid = ppb.getBussinessOrderId();
		PPPayment ppm = new PaymentDefaultWapper().selectPPPaymentByBussinessOrderId(businessoid).get(0);
		String trandno = ppm.getPaymentId();
		alinotifyBean.setOut_trade_no(trandno);
		alinotifyBean.setPayment_type("1");
		alinotifyBean.setPrice(aqb.getPayPrice());
		alinotifyBean.setQuantity("1");
		alinotifyBean.setRefund_status(null);
		alinotifyBean.setSeller_email("ap.ymt@ymatou.com");
		alinotifyBean.setSeller_id("2088701734809577");
		alinotifyBean.setSubject(aqb.getProductName());
		alinotifyBean.setTotal_fee(aqb.getPayPrice());
		alinotifyBean.setTrade_no(TestDataManager.getRandomUUID().toString());
		alinotifyBean.setTrade_status("TRADE_SUCCESS");
		alinotifyBean.setUse_coupon("N");
		return alinotifyBean;
	}
	/**
	 * 初始化 AliPayNotifyBean
	 * 
	 * @param aqb
	 * @return
	 * @throws InterruptedException
	 */
	private WeiXinNotifyBean initWeixinBean(AcquireOrderBean aqb) throws InterruptedException {
		// <xml><appid><![CDATA[wxf51a439c0416f182]]></appid>
		// <bank_type><![CDATA[CMB_DEBIT]]></bank_type>
		// <cash_fee><![CDATA[8200]]></cash_fee>
		// <fee_type><![CDATA[CNY]]></fee_type>
		// <is_subscribe><![CDATA[N]]></is_subscribe>
		// <mch_id><![CDATA[1234079001]]></mch_id>
		// <nonce_str><![CDATA[b82bbe0b28954973ad2a9c98618af516]]></nonce_str>
		// <openid><![CDATA[oASzYjrBI-LG8JMNSIC3c5VSynGU]]></openid>
		// <out_trade_no><![CDATA[20160412172258588000000000023844]]></out_trade_no>
		// <result_code><![CDATA[SUCCESS]]></result_code>
		// <return_code><![CDATA[SUCCESS]]></return_code>
		// <sign><![CDATA[E39042D497F3952F55F17D310B58EC36]]></sign>
		// <time_end><![CDATA[20160412172307]]></time_end>
		// <total_fee>8200</total_fee>
		// <trade_type><![CDATA[APP]]></trade_type>
		// <transaction_id><![CDATA[4009562001201604124771601467]]></transaction_id>
		// </xml>
		wxnotifyBean.setAppid("wxf51a439c0416f182");
		wxnotifyBean.setAttach(TestDataManager.getRandomUUID().toString());
		wxnotifyBean.setBank_type(BankIdEnum.CMB.name());
		Double payprice = Double.valueOf(aqb.getPayPrice());
		int iprice = (int) (payprice * 100);
		Logger.debug("iprice:" + iprice);
		wxnotifyBean.setCash_fee(String.valueOf(iprice));
		wxnotifyBean.setCash_fee_type(null);
		wxnotifyBean.setCoupon_count("0");
		wxnotifyBean.setCoupon_fee("0");
		wxnotifyBean.setDevice_info(TestDataManager.getRandomUUID().toString());
		wxnotifyBean.setErr_code(null);
		wxnotifyBean.setErr_code_des(null);
		wxnotifyBean.setFee_type("CNY");
		wxnotifyBean.setIs_subscribe("N");
		if (aqb.getPayType().equals("14")||aqb.getPayType().equals("16")) {
			wxnotifyBean.setMch_id("1278350701");
		} else {
			wxnotifyBean.setMch_id("1234079001");
		}
		wxnotifyBean.setNonce_str(TestDataManager.getRandomUUID().toString().replace("-", "").substring(0, 31));
		Map m = new DefaultWapper().selectLastWeixinUser();
		String uid = m.get("iYmtUserId").toString();
		wxnotifyBean.setOpenid(m.get("sOpenId").toString());
		// trandno 是PaymentId
		PPBussinessOrder ppb = new PaymentDefaultWapper().selectPPBussinessorderByTraceId(aqb.getTraceId()).get(0);
		String businessoid = ppb.getBussinessOrderId();
		PPPayment ppm = new PaymentDefaultWapper().selectPPPaymentByBussinessOrderId(businessoid).get(0);
		String trandno = ppm.getPaymentId();
		wxnotifyBean.setOut_trade_no(trandno);
		wxnotifyBean.setResult_code("SUCCESS");
		wxnotifyBean.setTime_end(YMTDateUtil.getSysTime("yyyyMMddHHmmss"));
		wxnotifyBean.setTotal_fee(String.valueOf(iprice));
		if (aqb.getPayType().equals("14")) {
			wxnotifyBean.setTrade_type("JSAPI");
		} else if (aqb.getPayType().equals("15")) {
			wxnotifyBean.setTrade_type("APP");
		} else {
			wxnotifyBean.setTrade_type("NATIVE");
		}
		wxnotifyBean.setTransaction_id(TestDataManager.getRandomUUID().toString().replace("-", "").substring(0, 31));
		wxnotifyBean.setReturn_code("SUCCESS");
		wxnotifyBean.setReturn_msg("成功");
		return wxnotifyBean;
	}

	/**
	 * 对源数据SignSHA1WithRSA加签
	 * 
	 * @param src
	 *            源数据
	 * @return
	 * @throws Exception
	 */
	private String SignSHA1WithRSA(String src) throws Exception {
		PrivateKey privateKey = RSAUtils.loadPrivateKey(EnvSetup.getData("privateK"));
		TreeMap tm = new TreeMap();
		tm.putAll((FormatUtil.httpStringToMap(src)));
		String fromatS = FormatUtil.mapToHttpString(tm, true);
		String signSWR = RSAUtils.SignSHA1WithRSA(fromatS, privateKey);
		return signSWR;
	}
}
